package JSE_03.Demo05;

import java.io.IOException;

public class Demo05TryCatch {
    public static void main(String[] args){
        try{
            readFile("d:\\a.tx");
        }catch(IOException e){
            System.out.println("catch-传递的文件后缀名不是.txt");
        }

        System.out.println("后续代码");
    }

    public static void readFile(String fileName) throws IOException {
        if(!fileName.endsWith(".txt")){
            throw new IOException("文件后缀名不对");
        }

        System.out.println("路径无问题");
    }
}
